<template>
  <div>
    <a-card>
      <a-row style="margin-bottom: 10px">
        <a-col :span="24"  style="display: flex;flex-direction: row-reverse">
          <a-button v-print="'#printReport'" type="primary">打印报表</a-button>
        </a-col>
      </a-row>
      <div id="printReport">
        <a-row>
          <a-col :span="24" style="text-align: center;font-size: 18px">MES</a-col>
        </a-row>
        <table border="1" cellpadding="4" cellspacing="0" bordercolor="#000" style="width: 100%">
          <tr>
            <th colspan="34">
              <div style="position: relative;text-align: center">
                <span>{{reportData.title}}</span>
                <span style="position: absolute;right: 0px;top:0px">{{ dateFormat(this.reportData.createTime,'YYYY-MM') }}</span>
              </div>
            </th>
          </tr>
          <tr>
            <td colspan="34">
              <a-row>
                <a-col :span="8">检查项目:{{ reportData.equipmentName }}</a-col>
                <a-col :span="8">检查位置:{{ reportData.equipmentModel }}</a-col>
                <a-col :span="8">启动检查时间:{{ reportData.createTime }}</a-col>
              </a-row>
            </td>
          </tr>
          <tr>
            <td>序号</td>
            <td>班前点检项目</td>
            <td>所在位置</td>
            <td v-for="i in 31">{{i}}</td>
          </tr>
          <tr v-for="(item,index) in reportData.dayCheckName" v-if="reportData.dayCheckName.length > 0">
            <td>{{index + 1}}</td>
            <td>{{item}}</td>
            <td>{{reportData.dayDealMethords[index]}}</td>
            <td v-for="i in reportData.dayCheckList[index]">{{i.inspectionResults}}</td>
          </tr>
          <tr v-if="reportData.dayCheckName.length > 0">
            <td rowspan="2">检查周期</td>
            <td rowspan="2">{{ reportData.inspectionCycle }}</td>
            <td>点检人：</td>
            <td v-for="i in reportData.dayCheckList[0]">{{i.maintainer}}</td>
          </tr>
          <tr v-if="reportData.dayCheckName.length > 0">
            <td>稽查人：</td>
            <td v-for="i in reportData.dayCheckList[0]">{{i.reviewer}}</td>
          </tr>
          <tr>
            <td colspan="34">记入方式:{{reportData.accountingMethod}}</td>
          </tr>
          <tr>
            <td colspan="34">
              备注：{{reportData.beCareful}}
            </td>
          </tr>
        </table>
      </div>
    </a-card>
  </div>
</template>

<script>
import { dateFormat } from '@/utils/util'
export default {
  /** 下班前安全检查点检表 **/
  name: 'SafetyCheckBeforeWork',
  props:{
    reportData:{
      type:Object,
      default:()=>{}
    },
    type:{
      type:String,
      default:''
    }
  },
  data(){
    return {
      checkList:[
        {
          checkName:'生产机型',
          location:'1'
        },
        {
          checkName:'程式名称',
          location:'2'
        },
      ],
    }
  },
  methods:{
    dateFormat
  }
}
</script>

<style scoped>

</style>